# coding = utf-8
# Author: 柚一
from appium.webdriver.common.appiumby import AppiumBy

from base.keywords import Keywords


class SchoolPage(Keywords):
    # 元素
    search_click = (AppiumBy.ID, 'com.tal.kaoyan:id/tv_search')
    search_input = (AppiumBy.ID, 'com.tal.kaoyan:id/customsearchview_contentedittext')
    result_list = (AppiumBy.XPATH, '//android.widget.TextView[@text="江苏大学"]')

    #点击搜索框
    def click_search(self):
        self.click_element(self.search_click)

    #往输入框输入内容
    def input_search(self,keyword):
        self.input_element(self.search_input,keyword)

    #验证输入的结果是否存在
    def is_result(self):
        try:
            return self.wait_explicit(self.result_list).is_displayed()
        except:
            return False